# 构建阶段
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/node:22-alpine3.21 AS builder
WORKDIR /app
COPY . .

RUN npm install --registry=https://registry.npmmirror.com

RUN npm run build:prod

# 生产运行阶段
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/nginx:1.27.3
LABEL authors="kdly"
COPY --from=builder --chown=101:101 /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80